{template 'common/header'}
{template 'common'}
<script type="text/javascript" src="https://api.map.baidu.com/api?v=2.0&ak=F51571495f717ff1194de02366bb8da9&s=1"></script>
<script type="text/javascript" src="resource/js/lib/jquery-ui-1.10.3.min.js"></script>
<link type="text/css" rel="stylesheet" href="../addons/kbwdl_shequzufang/images/uploadify_t.css" />
<script type="text/javascript" src="../addons/kbwdl_shequzufang/style/script/jquery.bigautocomplete.js"></script>
<link type="text/css" rel="stylesheet" href="../addons/kbwdl_shequzufang/style/css/my.css" />

<div class="kb-container">
    <div class="kb-slide">
        <div style="width: 100%; height: 1px;"></div>
        <div class="kb-slide1">
            <div class="list-group">
                {loop $submenus $menukey $menu}
                <a href="<?php echo $this->createWebUrl($menu['do'],['op'=>$menukey] );?>"
                    class="list-group-item <?php if($operation==$menukey ) echo 'active';?> ">
                    {$menu['name']}管理
                </a>
                {/loop}
                <!-- <a href="<?php echo $this->createWebUrl('send',['op'=>$operation] );?>"
                    class="list-group-item">
                    去发布
                </a> -->
            </div>
        </div>
    </div>
    <div class="kb-main">
        <!-- kb-main start -->
        {template $template_name} 
         <!-- kb-main end -->
    </div>
</div>

<div class="modal modal-type" tabindex="-1" role="dialog" id="showmapdatamodal">
    <div class="modal-dialog" role="document"  style="width: 400px;">
        <div class="modal-content">
            <div class="modal-header clearfix">
               当前小区的周边信息
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
            </div>
            <div class="modal-body">
                <div class="row" id="lbsdata">

               </div>
            </div>
        </div>
    </div>
</div>     
<script>
     function navcityto(obj) {
            var id = obj.value;
            $.ajax({
                url: "{php echo $this->createWebUrl('send', array('op'=>'cityareas'))}" + "&id=" + id,
                success: function (ret) {
                    $("#areasbd").html(ret);
                    $("#area").change(function () {
                        init_area_quan(this.value);

                    })
                }
            });

        }

          //覆盖打开地图方法
    function showCoordinate(elm){
        require(["util"], function(util){
            var val = {};
            val.lng = parseFloat($(elm).parent().prev().prev().find(":text").val());
            val.lat = parseFloat($(elm).parent().prev().find(":text").val());
            util.map(val, function(r){
                $(elm).parent().prev().prev().find(":text").val(r.lng);
                $(elm).parent().prev().find(":text").val(r.lat);
                $("#address").val(r.label);
            });
            
        });
        var address = $("#city_id option:selected").text() + $("#area").val() +$("#name").val();
		setTimeout(() => {
            $("#map-dialog input[type='text']").val(address) ;
            $("#map-dialog .modal-body .btn").trigger("click")
        }, 1500);  
        
			
    }
    function modifyCoordinate(id, lat, lng, address){
        require(["util"], function(util){
            util.map({lng: lng, lat:lat}, function(r){
                $.ajax({
                    type: 'POST',
                    url: "{php echo $this->createWebUrl('village', array('op'=>'savemap'))}"  ,
                    data:{ id: id, lat: r.lat, lng: r.lng, address: r.label},
                    success: function (ret) { 
                        $("#mapbiao"+id).css({color:'#3296fa'})
                    }
                });
            });
        });
        if(address){
            setTimeout(() => {
                $("#map-dialog input[type='text']").val(address) ;
                $("#map-dialog .modal-body .btn").trigger("click")
            }, 1500);  
        }
    }
    function showmapdata(village_id){
        $.ajax({
            type:'post',
            url: "{php echo $this->createWebUrl('village', array('op'=>'showlbsdata'))}"  ,
            data:{id : village_id},
            dataType:"html",
            success: function(html){
                $("#lbsdata").html(html)
                $("#showmapdatamodal").modal().show()
            }
        })
        
    }

</script>
{template 'common/footer'} 